﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Data;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using Common;
using Model;

namespace AcceptServer.Service
{
    public class OperateCmdData
    {
        //    private static TaxiGpsHistoryInfo _taxiGpsHistoryInfoBuffer = new TaxiGpsHistoryInfo();


        //    private static readonly Dictionary<int, byte[]> _imageDataBuffer = new Dictionary<int, byte[]>();

        public byte[] AnalysisMessageId(byte[] realData, IPAddress clientIp)
        {
            ushort messageId = OperateAgreement.GetMessageIdInMessageHead(realData);
           // Console.WriteLine(messageId);
            byte[] sendData = new byte[1];
            TaxiProtocol taxiProtocol=new TaxiProtocol();
            PhoneUserProtocol phoneUserProtocol = new PhoneUserProtocol();
            switch (messageId)
            {                
                case  ConstParameters.CmdTaxiLogin:
                    {
                        sendData = taxiProtocol.TaxiRegister(realData, clientIp);
                        break;
                    }
                case ConstParameters.CmdTaxiUpdataGpsInfo:
                    {
                        taxiProtocol.TaxiUpdataGpsInfo(realData,clientIp);
                        break;
                    }
                case ConstParameters.CmdTaxiCheckCard:
                    {
                        sendData = taxiProtocol.CheckIdentity(realData, clientIp);
                        break;
                    }
                case ConstParameters.CmdTaxiChangeCardPassword:
                    {
                        sendData = taxiProtocol.ChangePasswordOfIdCard(realData);
                        break;
                    }
                case ConstParameters.CmdTaxiRequstOrderInfo:
                    {
                        sendData = taxiProtocol.RequestOrderByCardId(realData);
                        break;
                    }
                case ConstParameters.CmdTaxiAcceptOrder:
                    {
                        sendData = taxiProtocol.DriverAcceptOrder(realData);
                        break;
                    }

                case ConstParameters.CmdPhoneUserLogin :
                    {
                        sendData = phoneUserProtocol.PhoneUserRegister(realData, clientIp);
                        break;
                    }
                case ConstParameters.CmdPhoneUserVerifyRegistCode:
                    {
                        sendData = phoneUserProtocol.PhoneUserVerifyRegistCode(realData);
                        break;
                    }
                case ConstParameters.CmdPhoneUserRegistRequest:
                    {
                        sendData = phoneUserProtocol.PhoneUserRegistRequest(realData);
                        break;
                    }
                case ConstParameters.CmdPhoneUserSubmitOrder:
                    {
                        sendData = phoneUserProtocol.PhoneUserSubmitOrder(realData);
                        break;
                    }     
                case ConstParameters.CmdPhoneUserAcceptOrder:
                    {
                        sendData = phoneUserProtocol.PhoneUserAcceptOrder(realData);
                        break;
                    }
                case ConstParameters.CmdPhoneUserCancleOrder:
                    {
                        sendData = phoneUserProtocol.PhoneUserCancleOrder(realData);
                        break;
                    }
                case ConstParameters.CmdPhoneUserPaidAnOrder:
                    {
                        sendData = phoneUserProtocol.PhoneUserPaidAnOrder(realData);
                        break;
                    }
                case ConstParameters.CmdPhoneUserUpdateInfo:
                    {
                        sendData = phoneUserProtocol.PhoneUserSetInfo(realData);
                        break;
                    }

            }
            return sendData;
        }




    }
}
